Skip to main content

Quickstart React Native

This guide will help you to implement the Group Link Mobile SDK on your application written for the React Native framework.

Requirements

  • Required software:
    • IDE (VSCode or Android Studio)
    • npm / yarn

Step 1 - Installing the SDK

Inside your project root folder paste one of the following lines on your terminal.

npm i @grouplinknetwork/rn-grouplink-sdk
yarn add @grouplinknetwork/rn-grouplink-sdk

Step 2 - Setup the SDK

To initialize our SDK for both Android and iOS platforms, you can use the following approach:

import * as GroupLinkSDK from '@grouplinknetwork/rn-grouplink-sdk';

export default function App() {
// This function requires the Group Link Token from your organization and
// accepts a boolean value to determine its debuggability.
GroupLinkSDK.startGrouplink("GROUP_LINK_TOKEN", isDebuggable);
return (
<View style={styles.container}>
<Text>This is a test app</Text>
</View>
);
}

We automatically detect the platform you're using and invoke the appropriate methods for SDK initialization.

However, if you'd like to initialize the SDK on a single platform, you can use the following method:

For iOS -

import * as GroupLinkSDK from '@grouplinknetwork/rn-grouplink-sdk';

export default function App() {
// This function requires the Group Link Token from your organization.
GroupLinkSDK.startGrouplinkIOS("GROUP_LINK_TOKEN");
return (
<View style={styles.container}>
<Text>This is a test app</Text>
</View>
);
}

For Android -

import * as GroupLinkSDK from '@grouplinknetwork/rn-grouplink-sdk';

export default function App() {
// This function requires the Group Link Token from your organization and
// accepts a boolean value to determine its debuggability.
GroupLinkSDK.startGrouplinkAndroid("GROUP_LINK_TOKEN", isDebuggable);
return (
<View style={styles.container}>
<Text>This is a test app</Text>
</View>
);
}

Next Steps

Now that you have successfully initialized the Group Link SDK inside your app, you have to follow the iOS and Android specific code.